package com.dididoctor.doctor.Activity.Main.Inquiry.NewInquiry.AddSingleAnswer;

import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;

import com.dididoctor.doctor.Activity.Main.Inquiry.InquiryDetail.InquiryDetail;
import com.dididoctor.doctor.MV.BaseFragment;
import com.dididoctor.doctor.R;

/**
 * @version 2.0
 * @类描述：
 * @项目名称：ddgh
 * @类名称： AddSingleAnswerFragment
 * @包名称： com.dididoctor.doctor.Activity.Main.Inquiry.NewInquiry
 * @创建人： zhanjunjie
 * @创建时间：2016/4/21 20:11
 * @修改人：
 * @修改时间：2016/4/21 20:11
 * @修改备注： new parent class(用一句话描述修改了什么)
 */
public class AddSingleAnswerFragment extends BaseFragment {

    private EditText mEtAnswer;
    private String content;
    private InquiryDetail inquiryDetail = new InquiryDetail();

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_add_single_answer, null);
        this.initview(rootView);
        return rootView;
    }

    private void initview(View rootView) {
        mEtAnswer = (EditText) rootView.findViewById(R.id.et_answer);
        inquiryDetail = (InquiryDetail) getArguments().getSerializable("inquiry");
        if (inquiryDetail != null) {
            mEtAnswer.setText(inquiryDetail.getContent());
            content = inquiryDetail.getContent();
        }

        mEtAnswer.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {
                content = s.toString();
            }
        });
    }

    public String getContent() {
        return content;
    }


}
